class SelectionSort():
    def __init__(self) -> None:
        self.count = 0
        pass

    def sort(self,ls):
        for i in range(len(ls)):
            minnumindex = i
            for j in range(i+1,len(ls)):
                self.count+=1
                if ls[j]<ls[minnumindex]:
                    # 选出最小的数的索引
                    minnumindex = j
                    
            ls[i],ls[minnumindex] = ls[minnumindex],ls[i]
    # 判断是否有序
    def isSorted(self,ls):
        for i in range(1,len(ls)):
            if ls[i]<ls[i-1]:
                return False
        return True

